package vn.ivs.taxiapp.adapters;

import java.util.ArrayList;

import vn.ivs.taxiapp.R;
import vn.ivs.taxiapp.models.TaxiInfo;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class S008ListViewAdapter extends ArrayAdapter<TaxiInfo> {
	private ArrayList<TaxiInfo> mTaxiInfoList;
	private Context context;
	private TextView mTvName;
	private ImageView mIvImage;

	public S008ListViewAdapter(Context context, ArrayList<TaxiInfo> listOb) {
		super(context, R.layout.s008_item_view, listOb);
		this.context = context;
		this.mTaxiInfoList = listOb;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {

		LayoutInflater inflater = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View rowView = inflater.inflate(R.layout.s008_item_view, parent, false);
		mTvName = (TextView) rowView.findViewById(R.id.s008_item_view_name);
		mIvImage = (ImageView) rowView.findViewById(R.id.s008_item_view_image);
		mTvName.setText(mTaxiInfoList.get(position).getName());
		mIvImage.setImageResource(R.drawable.default_image);
		return rowView;
	}
}
